/**   
* @Title: WebApp.java 
* @Package com.spider.core 
* @Description: TODO(用一句话描述该文件做什么) 
* @author cssuger@163.com   
* @date 2015年6月4日 上午11:29:41 
* @version V1.0   
*/
package com.bicon.base.data.common;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;



/** 
 * @ClassName: WebApp 
 * @Description: 
 * @author cssuger@163.com 
 * @date 2015年6月4日 上午11:29:41 
 *  
 */
public class SpringHelp {

	private   ApplicationContext context = null; 
	
	public volatile static SpringHelp app = null;
	
	public static  SpringHelp getInstance(){
		synchronized (SpringHelp.class) {
			if(null == app){
				synchronized (SpringHelp.class) {
					app = new SpringHelp();
				}
			}
		}
		return app; 
	}
	
	/** 
	 * <p>Title: </p> 
	 * <p>Description: </p>  
	 */
	private SpringHelp() {
		context = new ClassPathXmlApplicationContext(Constants.XMP_PATH);
		
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public Object getBean(String key,Class clazz){
		return context.getBean(key, clazz);
	}
	
	public Object getBean(String key){
		return context.getBean(key);
	}
	

	

	
}
